
class_name DuanTiWuZhe


static func CreateCardData() -> CardData:
	var data = CardData.new()
	
	data.attack = 30
	data.hp = 240
	data.maxHp = data.hp
	data.defence = 10
	data.speed = 8
	
	data.cardName = "锻体武者"
	data.cardDesc = "血量低于50%时\n防御力+5"
	data.image = load("res://texture/Role/锻体武者.png")
	
	return data


static func CreateCard() -> Card:
	var cardprefab = load("res://prefab/card.tscn")
	var card: Card = cardprefab.instantiate()
	
	var extData = {
		isBuffed = false
	}
	
	var data: CardData = CreateCardData()
	data.onHurt = func (damage):
		data.hp -= damage
		
		if !extData.isBuffed and data.hp < data.maxHp * 0.5:
			data.defence += 5
			card.runBuffAnim("防御 +5")
			extData.isBuffed = true
		
		if data.hp <= 0:
			data.hp = 0
			
			data.onDead.call()
	
	card.setData(data)
	
	return card
	


	
